<?php
namespace news\Controller;
use Common\Model\NewsCategoryModel;
use News\Controller\CommonController;
use Common\Model\NewsModel;

class ListController extends CommonController {
    public function index(){
        $id = I('get.id',0,'int');
        if($id){
            $cateModel = new NewsCategoryModel();
            $category = $cateModel->find($id);
            $model = new NewsModel();
            $data = $model->getList($id);

            $url = UU("News/list/index",array('id'=>$id));
            $page = PageShow($data['count'],$url);

            $this->assign('data',$data)->assign('page',$page)->assign('category',$category);
            $this->display('/news/list_index');
        }else{
            $this->display('404');
        }
    }
}